-
-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the type-utils package, split code, add some comments and examples #15743
Conversation
@@ -13,9 +14,6 @@ import type { ElectrumClient } from './client/electrum'; | |||
type BlockListener = ReturnType<typeof L.blockListener>; | |||
type TxListener = ReturnType<typeof L.txListener>; | |||
|
|||
// reason: | |||
// https://stackoverflow.com/questions/57103834/typescript-omit-a-property-from-all-interfaces-in-a-union-but-keep-the-union-s#answer-57103940 | |||
type Without<T, K extends keyof any> = T extends any ? Omit<T, K> : never; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is exactly same as here.
@@ -1,7 +1,7 @@ | |||
/* eslint-disable @typescript-eslint/no-use-before-define */ | |||
// code shamelessly stolen from https://github.com/voodoocreation/ts-deepmerge | |||
|
|||
type TAllKeys<T> = T extends any ? keyof T : never; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as here
export type ItemExtractor<M> = Extract<M, { type: M }>; | ||
|
||
// Unwrap type from Promise | ||
export type Await<T> = T extends { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
@@ -30,757 +65,46 @@ export type ConstWithOptionalFields< | |||
}; | |||
}; | |||
|
|||
// Extract item from union | |||
export type ItemExtractor<M> = Extract<M, { type: M }>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
No description provided.